package com.itheima.advance.classloader.demo01;

/**
 * 获取类加载器
 */
public class ClassLoaderDemo01 {

    public static void main(String[] args) {

        // 直接调用ClassLoader中的静态方法获取系统类加载器
        ClassLoader classLoader = ClassLoader.getSystemClassLoader();
        System.out.println(classLoader);            // jdk.internal.loader.ClassLoaders$AppClassLoader@2437c6dc

        System.out.println("------------------------------------------------");

        // 获取系统类加载器对应的父类加载器
        ClassLoader classLoaderParent = classLoader.getParent();
        System.out.println(classLoaderParent);      // jdk.internal.loader.ClassLoaders$PlatformClassLoader@880ec60

        System.out.println("------------------------------------------------");

        // 获取平台类加载器所对应的父类
        ClassLoader loaderParentParent = classLoaderParent.getParent();
        System.out.println(loaderParentParent);     // null

    }

}
